package com.hillstone.hsm.swtool.shellp.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hillstone.hsm.swtool.shellp.common.AjaxResult;
import com.hillstone.hsm.swtool.shellp.model.User;
import com.hillstone.hsm.swtool.shellp.service.UserService;

/**
 * @ClassName: UserController
 * @Description: 用户Controller
 */
@Controller
public class UserController {

	@Autowired
	private UserService userService;

	@ResponseBody
	@RequestMapping("/queryList")
	public AjaxResult queryList() {
		return userService.queryList();
	}

	@ResponseBody
	@RequestMapping("/addUser")
	public AjaxResult addUser(User user) {
		return userService.save(user);
	}

	@ResponseBody
	@RequestMapping("/delUser")
	public AjaxResult delUser(Integer[] ids) {
		return userService.batchDelete(ids);
	}

	@ResponseBody
	@RequestMapping("/updateUser")
	public AjaxResult updateUser(User user) {
		return userService.update(user);
	}

	@RequestMapping("/hello")
	public String hello(ModelMap map) {
		map.put("title", "你好");
		return "index";
	}

}